package com.example.clientserver01.controller;

import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;

/**
 * @ClassName HelloController
 * @Description TODO
 * @Author leejiliang
 * @DateTime 2020/4/26 11:27 AM
 * @Version 1.0
 */
@RestController
public class HelloController {
	@GetMapping("/hello")
	public String hello() {
		Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
		return authentication.getName() + Arrays.toString(authentication.getAuthorities().toArray());
	}
}
